package com.guoranhao.business.service.impl;

import com.google.common.collect.Lists;
import com.guoranhao.business.dao.AppFunctionIconMapper;
import com.guoranhao.business.model.AppFunctionIcon;
import com.guoranhao.business.model.AppFunctionIconExample;
import com.guoranhao.business.param.AdminGetAppFunctionIconListParam;
import com.guoranhao.business.service.AppFunctionIconService;
import com.guoranhao.business.vo.AppFunctionIconAdminVo;
import com.guoranhao.tool.enums.ZeroOrOneEnum;
import com.guoranhao.tool.vo.AdminResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppFunctionIconServiceImpl extends BaseServiceImpl<AppFunctionIcon, AppFunctionIconExample> implements AppFunctionIconService {

	@Autowired
	private AppFunctionIconMapper appFunctionIconMapper;

	@Override
	public AdminResultVo<AppFunctionIconAdminVo> getAppFunctionIconListForAdmin(AdminGetAppFunctionIconListParam param) {
		Integer count = appFunctionIconMapper.getAppFunctionIconListCountForAdmin(param);
		if (ZeroOrOneEnum.ZERO.getCode().equals(count)){
			return new AdminResultVo<>(count, Lists.newArrayList());
		}
		List<AppFunctionIconAdminVo> list = appFunctionIconMapper.getAppFunctionIconListForAdmin(param);
		return new AdminResultVo<>(count,list);
	}
}
